import Vue from 'vue'
import VueCookies from 'vue-cookies'
Vue.use(VueCookies)

//删除全部key
export function removeAllKeys() {
	 VueCookies.keys().forEach((item) => {
		VueCookies.remove(item)
	})
}
VueCookies.removeAllKeys = removeAllKeys
const TokenKey = 'Admin-Token' //token
const RolesKey = 'Admin-Rloes' //路由
const SidebarKey = 'Sidebar-Key'// 
const SidebarOpen = 'Sidebar-Open'
const SidebarWidth = 'Sidebar-Width'
const Size ="Size"
export function getToken() {
	return VueCookies.get(TokenKey)
}
export function setToken(token) {
	return VueCookies.set(TokenKey,token, '7d')
}
export function removeToken() {
	return VueCookies.remove(TokenKey)
}
export function getRoles() {
	return VueCookies.get(RolesKey)
}
export function setRoles(roles) {
	return VueCookies.set(RolesKey, roles,'7d')
}
export function removeRoles() {
	return VueCookies.remove(RolesKey)
}
export function getSidebar() {
	return VueCookies.get(SidebarKey)
}
export function setSidebar(roles) {
	return VueCookies.set(SidebarKey, roles)
}
export function removeSidebar() {
	return VueCookies.remove(SidebarKey)
}
export function getSidebarOpen() {
	return VueCookies.get(SidebarOpen)
}
export function setSidebarOpen(isopen) {
	return VueCookies.set(SidebarOpen, isopen)
}
export function getSidebarWidth() {
	return VueCookies.get(SidebarWidth)
}
export function setSidebarWidth(width) {
	return VueCookies.set(SidebarWidth, width)
}
export function getSize() {
	return VueCookies.get(Size)
}
export function setSize(size) {
	return VueCookies.set(Size, size)
}
const CookiesAll = {
	removeAllKeys,
	getToken,
	setToken,
	removeToken,
	getRoles,
	setRoles,
	removeRoles,
	getSidebar,
	setSidebar,
	removeSidebar
}
export default CookiesAll
